package com.lbx.controller;

import com.lbx.mapper.UserMapper;
import com.lbx.util.CommonRes;
import com.lbx.util.ResUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;

/**
 * (User)表控制层
 *
 * @author lbx
 * @since 2021-06-18 15:04:30
 */
@RestController
@CrossOrigin
@RequestMapping("vue-element-admin/user")
public class UserController {
    /**
     * 服务对象
     */
    @Resource
    private UserMapper userMapper;
    @RequestMapping("login")
    public CommonRes<Object> login(@RequestBody HashMap<String,String> requestMap){
        HashMap<String,Object> hashMap = new HashMap<>();
        hashMap.put("id",1);
        hashMap.put("token","lbx"+System.currentTimeMillis());
        return ResUtil.successRes(20000,"success",hashMap);
    }
    
    @RequestMapping("info")
    public CommonRes<Object> info( String token){
        return ResUtil.successRes(20000,"success",userMapper.queryById(1L));
    }
    
    
    @RequestMapping("logout")
    public CommonRes<Object> logout(){
        return ResUtil.successRes(20000,"success",null);
    }
    
}
